import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';
// import 'package:mini_bmob/mini_bmob.dart';

class RegisterViewModel extends GetxController {
  final TextEditingController phoneController = TextEditingController();
  final TextEditingController pwdController = TextEditingController();
  final TextEditingController pwd1Controller = TextEditingController();

  final obscure = true.obs;

  void registerClick() {
    if (phoneController.text.isEmpty) {
      Fluttertoast.showToast(msg: "请输入手机号");
      return;
    }

    if (pwdController.text.isEmpty) {
      Fluttertoast.showToast(msg: "请输入密码");
      return;
    }

    if (pwd1Controller.text.isEmpty) {
      Fluttertoast.showToast(msg: "两次密码不一致");
      return;
    }

    if (pwd1Controller.text != pwdController.text) {
      Fluttertoast.showToast(msg: "两次密码不一致");
      return;
    }

    // BmobUserTable _user = BmobUserTable(
    //     username: phoneController.text, password: pwdController.text);
    // _user.install().then((value) {
    //   if (value) {
    //     Fluttertoast.showToast(msg: "注册成功，请登录");
    //     Get.back();
    //   } else {
    //     Fluttertoast.showToast(msg: "注册失败");
    //   }
    // });
  }
}
